package com.linkage.bss.crm.packagemgr.dao;

import java.util.List;
import java.util.Map;

import com.linkage.bss.crm.packagemgr.model.ActionOrderItem;
import com.linkage.bss.crm.packagemgr.model.ActionParameter;
import com.linkage.bss.crm.packagemgr.model.OfferRoles;
import com.linkage.bss.crm.packagemgr.model.OfferSpecDto;
import com.linkage.bss.crm.packagemgr.model.PackageObject;
import com.linkage.bss.crm.packagemgr.model.ParameterActionRela;
import com.linkage.bss.crm.packagemgr.model.ParameterMapRela;
import com.linkage.bss.crm.packagemgr.model.RoleObj;

/**
 * 包对象数据访问接口
 * @author  xiesh
 * @version  [版本号, 2013-5-9]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
public interface IPackageObjDAO {

	/**
	 * 根据包ID查询动作条目
	 * @param packageId
	 * @return 动作条目集合
	 *
	 */
	public List<ActionOrderItem> queryActionOrderItemByPackId(Long packageId);

	public List<ActionOrderItem> queryActionOrderItemByParams(Map<String, Object> params);

	public Long queryActonOrderItemCount(Map<String, Object> params);

	public List<ParameterActionRela> queryParamActionRelaByParamId(Long paramId);

	public ParameterMapRela queryParamMapRelaByParamId(Long paramId);

	/**
	 * 查询包对象
	 * @param params
	 * {packageId, objectNumber} packageId必选
	 * @return [参数说明]
	 *
	 */
	public List<PackageObject> queryPackgeObject(Map<String, Object> params);

	/**
	 * 查询销售品成员信息
	 * @param params {offerSpecId}
	 * @return [参数说明]
	 *
	 */
	public List<OfferRoles> queryOfferRoles(Map<String, Object> params);

	public List<RoleObj> queryRoleObjs(Map<String, Object> params);

	public List<Map<String, Object>> queryServSpecRela(Map<String, Object> params);

	/**
	 * 查询与当前销售品互斥的销售品规格
	 * @param offerSpecId
	 * @return [参数说明]
	 *
	 */
	public List<String> queryOfferExcludeInfo(String offerSpecId);

	/**
	 * 查询与当前销售品存在依赖关系的销售品规格
	 * @param offerSpecId
	 * @return [参数说明]
	 *
	 */
	public List<Map<String, String>> queryOfferRelaInfo(String offerSpecId);

	/**
	 * 查询与当前销售品存在依赖关系的销售品规格
	 * @param offerSpecId
	 * @return [参数说明]
	 *
	 */
	public List<Map<String, String>> querySelectOfferRelaInfo(String offerSpecId);

	/**
	 * 查询包含依赖销售品的动作条目个数
	 * @param params
	 * @return [参数说明]
	 *
	 */
	public Long queryRelaActionItemCount(Map<String, Object> params);

	/**
	 * 查询有效的产品包对象个数
	 * @param prodSpecId
	 * @return [参数说明]
	 *
	 */
	public Long queryAvailableProdObjCount(Map<String, Object> params);

	/**
	 * 查询有效的销售品包对象个数
	 * @param offerSpecId
	 * @return [参数说明]
	 *
	 */
	public Long queryAvailableOfferObjCount(Map<String, Object> params);

	/**
	 * 查询连带的销售品规格
	 * @param offerSpecId
	 * @return [参数说明]
	 *
	 */
	public List<String> queryRelatedOffers(String offerSpecId);

	public String ifCompOffer(String offerSpecId);

	/**
	 * 获取条目参数信息
	 * @param actionItemId 条目ID
	 * @return 参数集合
	 *
	 * @return List<ActionParameter> [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public List<ActionParameter> getActionParameterByAID(Long actionItemId);

	public void insertActionItem(ActionOrderItem item);

	public void insertPackageObj(PackageObject obj);

	public void insertActionParameter(ActionParameter param);

	public void insertParameterActionRela(ParameterActionRela parameterActionRela);

	public void insertParameterMapRela(Long packageParamID, Long actionParamID);

	public void updatePackageObj(PackageObject obj);

	public void updateActionOrderItem(ActionOrderItem actionOrderItem);

	public void deleteActionOrderItem(ActionOrderItem actionOrderItem);

	public void deleteParamRela(Long actionItemId);

	public void deleteParamMap(Long paramId);

	public void deleteActionParam(String paramId);

	/**
	 * 根据条目Id 来删除。
	 * <功能详细描述>
	 * @param itemId [参数说明]
	 *
	 * @return void [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public void deleteActionOrderItem(Long itemId);

	/**
	 * 删除参数决定条目
	 * @param packageId [参数说明]
	 *
	 * @return void [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public void delParameterActionRelaByPackId(Long packageId);

	/**
	 *删除动作参数
	 *
	 * @return void [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public void delActionParameterByPackId(Long packageId);

	/**
	 * 删除动作
	 * @param packageId [参数说明]
	 *
	 * @return void [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public void delActionOrderItemByPackId(Long packageId);

	/**
	 * 删除包参数与条目参数关联关系
	 * @param packageId [参数说明]
	 * 
	 * @return void [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public void delParameterMapRelaByPackId(Long packageId);

	/**
	 * 删除包参数
	 * @param packageId [参数说明]
	 * 
	 * @return void [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public void delPackageParameterByPackId(Long packageId);

	/**
	 * 删除包对象， 根据包id , 编码来 删除 。
	 * @param packageId
	 * @param nbr [参数说明]
	 *
	 * @return void [返回类型说明]
	 * @exception throws [违例类型] [违例说明]
	 * @see [类、类#方法、类#成员]
	 */
	public void deletePackgeObj(Long packageId, String nbr);

	public List<ParameterActionRela> queryParameterActionRelasByPackId(Long packId);

	public List<ParameterMapRela> queryParameterMapRelasByPackId(Long packId);

	/**
	 * 根据对象查询适用的核心销售品
	 * @param Map{"offerSpecId":30025500314,"offerRoleId":"300251070019","roleCd":"131","objId":"2","objType":"2"}
	 * @return [参数说明]
	 *
	 */
	public List<OfferSpecDto> queryCoreOfferByObj(Map<String, Object> params);

	/**
	 * 销售品成员是否配置了基础
	 * @param params
	 * @return [参数说明]
	 * 
	 */
	public boolean ifHasBaseOfferCfg(Map<String, Object> params);

	/**
	 * 获取销售品的同预同后成员列表
	 * @param offerSpecId 销售品规格Id
	 * @author 
	 * @return List<Long offerRoleId> 销售品成员角色Id列表
	 * 
	 */
	public List<RoleObj> getSameFeeTypeRoleListByOfferSpecId(Map<String, Object> params);

	/**
	 * 判断两个销售品是否互斥
	 * @param offerSpecId
	 * @param destOfferSpecId
	 * @return [参数说明]
	 * 
	 */
	public boolean isOfferExclude(String offerSpecId, String destOfferSpecId);

	/**
	 * 销售品是否为主销售品
	 * @param offerSpecId
	 * @return [参数说明]
	 */
	public boolean ifOfferIsMainOffer(String offerSpecId);

	/**
	 * 根据规格ID查销售品信息
	 * @param offerSpecId
	 * @return [参数说明]
	 * 
	 */
	public OfferSpecDto queryOfferSpecByOfferSpecId(String offerSpecId);

	/**
	 * 获取组合下的成员所依赖的销售品组
	 * @param offerSpecId
	 * @return [参数说明]
	 */
	public List<Map> getOfferMemRelaGrps(Map<String, Object> params);

	/**
	 * 根据销售品组ID查销售品组成员信息
	 * @param relaGrpId
	 * @return [参数说明]
	 * 
	 */
	public List<Map> getOfferGrpMemsByGrpId(String relaGrpId);
}
